/* Component info --------------------------------------------------------------
 * Author    : PURESUN
 * Version   : V1.0.0
 * Notes     : ui component status bar
 * Update    : 2023-12-19
 -----------------------------------------------------------------------------*/

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STATUS_BAR_H__
#define __STATUS_BAR_H__

/* Includes ------------------------------------------------------------------*/
#include "pub_types.h"
#include "lvgl/lvgl.h"

/* Exported macro ------------------------------------------------------------*/
#define STATUS_BAR_ICON_NAME_LEN_MAX 16
#define STATUS_BAR_ICON_CONTENT_LEN_MAX 8

/* Exported typedef ----------------------------------------------------------*/
typedef struct __status_icon_t__
{
    lv_obj_t *icon;
    char name[STATUS_BAR_ICON_NAME_LEN_MAX];
    char content[STATUS_BAR_ICON_CONTENT_LEN_MAX];
    struct __status_icon_t__ *next;
} status_icon_t;

typedef struct __ui_status_bar_t__
{
    lv_coord_t box_w;
    lv_coord_t box_h;
    lv_coord_t icon_w;
    lv_coord_t icon_h;
    status_icon_t *icon_head;
    lv_obj_t *box;
    lv_obj_t *time;
} status_bar_t;

/* Exported variables --------------------------------------------------------*/

/* Exported function prototypes ----------------------------------------------*/
void status_bar_init(status_bar_t *status_bar);
status_bar_t *status_bar_create(status_bar_t *status_bar, lv_obj_t *parent);
void status_bar_destroy(status_bar_t *status_bar);
void status_bar_set_time(status_bar_t *status_bar, char *time);
void status_bar_add_icon(status_bar_t *status_bar, string name, string content);
void status_bar_remove_icon(status_bar_t *status_bar, string name);
void status_bar_set_icon(status_bar_t *status_bar, string name, string content);
void status_bar_refresh(status_bar_t *status_bar);
#endif /* __STATUS_BAR_H__ */